package com.shengyin.ec.service.cluster;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shengyin.ec.model.dao.cluster.ClusterDao;
import com.shengyin.ec.model.dao.goods.GoodsDao;
import com.shengyin.ec.model.dao.order.OrderDao;
import com.shengyin.ec.model.entity.ChainCompany;
import com.shengyin.ec.model.entity.ClusterCompany;
import com.shengyin.ec.model.entity.Company;
import com.shengyin.ec.model.entity.Goods;
import com.shengyin.ec.model.entity.Orders;
import com.shengyin.ec.model.entity.Personal;

@Service("clusterService")
public class ClusterServiceImpl implements ClusterService {
	
	@Autowired
	ClusterDao clusterDao;
	
	@Autowired
	GoodsDao goodsDao;
	
	@Override
	public boolean checkCompanyUser(String username, String password) {
		
		return clusterDao.checkCompanyUser(username, password);
	}


	public void createClusterCompany(ClusterCompany clusterCompany) {
		clusterDao.save(clusterCompany);		
	}

	@Override
	public void deleteClusterCompany(ClusterCompany clusterCompany) {
		clusterDao.deleteClusterCompany(clusterCompany);		
	}

	@Override
	public void deleteClusterCompany(long id) {
		clusterDao.deleteByKey(id);		
	}

	@Override
	public void modifyClusterCompany(ClusterCompany clusterCompany) {
		clusterDao.modifyClusterCompany(clusterCompany);		
	}
	
	@Override
	public List<Personal> getCompanyByName(String username) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ClusterCompany getClusterCompanyByUsername(
			String clusterCompanyUsrname) {
		return clusterDao.getClusterCompanyByUsername(clusterCompanyUsrname);
	}


	@Override
	public ClusterCompany getClusterCompany(ClusterCompany clusterCompany) {
return null;		
	}

	@Override
	public void deleteSelectedCluster(String[] ids) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public ClusterCompany getClusterCompany(long id) {
		return clusterDao.getClusterCompany(id);
	}

	@Override
	public List<ClusterCompany> getClusterCompanyList() {
		return clusterDao.getClusterCompanyList();
	}

	@Override
	public List<ClusterCompany> getClusterCompanyList(int start, int end) {
		return clusterDao.getClusterCompanyList(start, end);
	}

	@Override
	public List<ClusterCompany> getClusterCompanyListByKeyword(String keyword,
			int start, int end) {
		return clusterDao.getClusterCompanyListByKeyword(keyword, start, end);
	}
    
	/*
	 * 连锁管理
	 */
	@Override
	public List<ChainCompany> getChainCompanyList(String keyword, int start,
			int end) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ChainCompany> getChainCompanyList(int start, int end) {
		// TODO Auto-generated method stub
		return null;
	}
   
	/*
	 * 商品管理
	 */
	@Override
	public List<Goods> getClusterCompanyGoodsList(int start, int end) {
		return clusterDao.getClusterCompanyGoodsList(start, end);	
	}
	
	@Override
	public List<Goods> getClusterCompanyGoodsList(long clusterCompanyid,
			int offset, int pageSize) {
		
		return clusterDao.getClusterCompanyGoodsList(clusterCompanyid,offset, pageSize);
	}
	
	@Override
	public List<Goods> getClusterCompanyGoodsList(String[] paramValues,int searchType,
			int offset, int pageSize) {
		
		return clusterDao.getClusterCompanyGoodsList(paramValues,searchType,offset, pageSize);
	}

	@Override
	public List<Goods> getClusterCompanyGoodsList(String[] paramValues) {
		
		return clusterDao.getClusterCompanyGoodsList(paramValues);
	}
	@Override
	public Long getTotal(long clusterCompanyId) {
		
		return clusterDao.getTotal(clusterCompanyId);
	}

	
	/*
     * 圣茵后台集群企业管理
     */
	
	public List<ClusterCompany> getCompanyList(int offset,int pageSize){
		
		return clusterDao.getCompanyList(offset, pageSize);
	}
	
	public Long getTotal(){
		
		return clusterDao.getTotal();
	}
	
    public List<ClusterCompany> getCompany(int status,int offset,int pageSize){
    	
    	return clusterDao.getCompany(status,offset,pageSize);
    }
	
	public List<ClusterCompany> getCompany(int status){
		
		return clusterDao.getCompany(status);
	}

    public List<ClusterCompany> getCompanyListByName(String keyword,int offset,int pageSize){
    	
    	return clusterDao.getCompanyListByName(keyword, offset, pageSize);
    }
	
	public List<ClusterCompany> getCompanyListByName(String keyword){
		
		return clusterDao.getCompanyListByName(keyword);
	}
}
